#include <stdio.h>
#include <unistd.h>
#include <string.h>
#define NUM 100
int main()
{
    char bar[NUM + 1];
    const char cir[4] = {'|', '/', '-', '\\'};
    memset(bar, '\0', NUM + 1);
    int count = 0;
    while (count <= NUM)
    {
        printf("[%-100s][%3d%%][%c]\r", bar, count, cir[count % 4]);
        bar[count++] = '#';
        fflush(stdout);
        usleep(50000);
    }
    printf("\n");
    return 0;
}
